package com.example.crm.repository;

import com.example.crm.entity.Right;
import com.example.crm.entity.Role;
import com.example.crm.entity.User;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;

import java.util.List;

/**
 * @author lenovo
 */
public interface RoleRepository extends JpaRepository<Role,Long> {
    /**
     * 根据角色名称进行模糊查询并分页
     * @param roleName
     * @param pageable
     * @return
     */
    public Page<Role> findRolesByRoleNameLike(String roleName, Pageable pageable);

    /**
     * 根据用户名查询角色对象
     * @param user
     * @return
     */
    public Role findRoleByUsers(User user);
}